home *** CD-ROM | disk | FTP | other *** search
- Rem Project: Planet Potter
- Rem Created: 25/07/2002 15:38:30
-
- rem Initialise
- sync on : sync rate 60 : hide mouse
- set text font "Arial" : set text size 20
- set text to bold : set text transparent
-
- rem Load environment
- load object "media\moonlit\ml.x",100
- scale object 100,20,20,20
- set object cull 100,0
- set object light 100,0
- set object texture 100,2,1
-
- rem Load nine planets
- for p=1 to 9
- load object "media\planet\planet.x",p
- position object p,(p-3)*350,0,500
- hide object p
- next p
-
- rem Load tenth planet for home
- load object "media\planet\planet.x",10
- position object 10,0,-150,-350
- rotate object 10,0,0,90
-
- rem Load particle image
- load image "media\gfx\fire.bmp",1
-
- rem Load player sounds
- load sound "media\sounds\shoot.wav",1
-
- rem Load game sounds
- load sound "media\sounds\appear.wav",11
- for s=12 to 19 : clone sound s,11 : next s
- load sound "media\sounds\explode.wav",21
- for s=22 to 29 : clone sound s,21 : next s
-
- rem Setup camera and light
- set camera range 0.1,3000
- set point light 0,-50,80,-600
- set light range 0,2000
-
- rem Main Loop
- do
-
- rem Get ready prompt
- center text screen width()/2,screen height()/2,"GET READY!" : sync
- sleep 3000 : show mouse
-
- rem Starting states
- randomize timer()
- energy=100 : prate=100
- points=0
-
- rem Game loop
- gameover=0
- while gameover=0
-
- rem Control player cursor and shot
- if mouseclick()=1 and guncool=-1
- rem Shoot effect
- play sound 1 : guncool=3
- rem Detect good hit
- for p=1 to 9
- if object visible(p)=1 and object angle z(p)=0
- sx=object screen x(p)
- sy=object screen y(p)
- mx=mousex() : my=mousey()
- if mx>sx-100 and mx<sx+100 and my>sy-100 and my<sy+100
- zrotate object p,1
- play sound 20+p
- inc points,10
- endif
- endif
- next p
- endif
- if guncool=0 and mouseclick()=0 then guncool=-1
- if guncool>0 then dec guncool
-
- rem Control planets
- gosub _newplanets
- gosub _moveplanets
-
- rem Rotate sky backdrop and home planet
- yrotate object 100,wrapvalue(object angle y(100)+0.1)
- yrotate object 10,wrapvalue(object angle y(10)-0.05)
-
- rem Stats
- prompt$="SCORE: "+str$(points)
- box 40,screen height()-20,41+(energy*3),screen height()-40,0,0,rgb(255,0,0),rgb(255,0,0)
- center text screen width()-text width(prompt$),screen height()-40,prompt$
-
- rem Update screen
- sync
-
- rem End loop
- endwhile
-
- rem High score prompt
- hide mouse
- center text screen width()/2,screen height()/2,"YOUR SCORE : "+str$(points) : sync
- sleep 3000
-
- rem Reset objects
- for p=1 to 9
- hide object p
- next p
-
- rem Main endloop
- loop
- end
-
- _newplanets:
-
- if pmaker>0 then dec pmaker
- if pmaker=0
- p=1 : while object visible(p)=1 and p<9 : inc p : endwhile
- ssx=1000+(prate*10.0)
- ssy=1000+(prate*5.0)
- x=rnd(ssx)-(ssx/2)
- y=rnd(ssy)-(ssy/2)
- position object p,x,y,1000
- scale object p,100,100,100
- rotate object p,0,0,0
- ghost object off p
- play sound 10+p
- show object p
- pmaker=prate+rnd(prate/2)
- if prate>15 then dec prate,5
- endif
-
- return
-
- _moveplanets:
-
- rem Move all planets
- for p=1 to 9
- `
- if object visible(p)=1 and object angle z(p)=0
- `
- rem Move planet
- sp#=25-(prate/10.0)
- position object p,object position x(p)/1.01,(object position y(p)-1)/1.01,object position z(p)-sp#
- yrotate object p,wrapvalue(object angle y(p)+1)
- if object position z(p)<-600 then hide object p
- `
- rem Detect when hit home planet
- dx#=abs(object position x(p)-object position x(10))
- dy#=abs(object position y(p)-object position y(10))
- dz#=abs(object position z(p)-object position z(10))
- dist#=sqrt((dx#*dx#)+(dy#*dy#)+(dz#*dz#))
- if dist#<300
- zrotate object p,1
- play sound 20+p
- energy=energy-20
- if energy<=0 then gameover=1
- endif
- `
- endif
- `
- next p
-
- rem Handle planet destruction
- for p=1 to 9
- if object angle z(p)>0 and object visible(p)=1
- s=50-object angle z(p)
- ghost object on p,2
- scale object p,s*2,s*2,s*2
- zrotate object p,object angle z(p)+1
- if object angle z(p)>70
- hide object p
- endif
- endif
- next p
-
- return
-
-
-
-